var url    = require("url");
var querystring = require("querystring"), fs = require("fs"), Client = require('mysql').Client;
var Client = require('mysql').Client;
var mysql = require('mysql');
/*
 * This function will be called to populate the drop down box every time the page loads
 */
exports.getKanton = function(req, res){
	var client = new Client(); 
	client.user = 'morgan';
	client.password = 'm0rgan$$$';
	client.host="127.0.0.1";
	//client.port="3306";
	client.database="orgeldb"
	
	var records = ""
	var query = "SELECT * from kanton k where id>0 AND id<31 AND id!=8 AND id!=9 or id= '' order by k.name asc ;";
		
	client.query(query, function selectCb(err, results, fields) {
    	if (err) {
      		throw err;
    	}
    	client.end();
    	records = JSON.stringify(results);
		res.render('dropDown.ejs', {
			kantons: records
		})
	});
}